package ejb.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the city database table.
 * 
 */
@Entity
@Table(name="city")
@NamedQueries({
	@NamedQuery(name="DefaultCity.findAll", query="SELECT ct FROM DefaultCity ct"),
	@NamedQuery(name="DefaultCity.findById", query="SELECT ct FROM DefaultCity ct WHERE ct.id = :id")
})
public class DefaultCity implements Serializable, City {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;

	private String name;

	private int positionX;

	private int positionY;

	private float pressure;

	private float temperature;
	
	private int conditions;
	
	@OneToMany(mappedBy="city", targetEntity=DefaultForecast.class, fetch=FetchType.EAGER)
	private List<Forecast> forecasts;

    public DefaultCity() {
    }

	/* (non-Javadoc)
	 * @see ejb.entity.City#getId()
	 */
	@Override
	public int getId() {
		return this.id;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setId(int)
	 */
	@Override
	public void setId(int id) {
		this.id = id;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#getName()
	 */
	@Override
	public String getName() {
		return this.name;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setName(java.lang.String)
	 */
	@Override
	public void setName(String name) {
		this.name = name;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#getPositionX()
	 */
	@Override
	public int getPositionX() {
		return this.positionX;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setPositionX(int)
	 */
	@Override
	public void setPositionX(int positionX) {
		this.positionX = positionX;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#getPositionY()
	 */
	@Override
	public int getPositionY() {
		return this.positionY;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setPositionY(int)
	 */
	@Override
	public void setPositionY(int positionY) {
		this.positionY = positionY;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#getPressure()
	 */
	@Override
	public float getPressure() {
		return this.pressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setPressure(float)
	 */
	@Override
	public void setPressure(float pressure) {
		this.pressure = pressure;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#getTemperature()
	 */
	@Override
	public float getTemperature() {
		return this.temperature;
	}

	/* (non-Javadoc)
	 * @see ejb.entity.City#setTemperature(float)
	 */
	@Override
	public void setTemperature(float temperature) {
		this.temperature = temperature;
	}

	@Override
	public int getConditions() {
		return conditions;
	}

	@Override
	public void setConditions(int conditions) {
		this.conditions = conditions;
	}

	public List<Forecast> getForecasts() {
		return forecasts;
	}

	public void setForecasts(List<Forecast> forecasts) {
		this.forecasts = forecasts;
	}

}